import axios from '@/utils/axios'

/**
 * 登录
 * @param {*} username 
 * @param {*} password 
 * @returns 
 */
export const login = (data) => axios.post('/login', {data})

/**
 * 注册
 * @param {*} data 
 * @returns 
 */
export const register = (data) => axios.post('/register', {data})

/**
 * 获取用户信息
 * @returns 
 */
export const getUserInfo = () => axios.get('/user/getUserInfo')

/**
 * 修改用户名
 * @param {*} username 
 * @returns 
 */
export const changeUsername = (username) => axios.put('/user/changeUsername', {data: {username}})

/**
 * 修改密码
 * @param {*} oldPassword 
 * @param {*} newPassword  
 * @returns 
 */
export const changePass = (oldPassword, newPassword) => axios.put('/user/changePass', {data: {oldPassword,newPassword}})